Skip to content

perf(gpu): overlap font and launcher setup with GL context creation - #81

Merged
piny4man merged 1 commit into
mainfrom
perf/overlap-startup
Oct 17, 2026
Merged

piny4man merged 1 commit into
mainfrom
perf/overlap-startup

Conversation

@piny4man

Copy link
Copy Markdown
Owner

NUKE-112. Every open built the fonts and, on the native frontend, the LauncherCore (app discovery, history, scores) on the main thread before it created the event loop, window and GL context. Neither is needed until the cell renderer is built and the first paint happens. NUKE-111 reduced fonts to about 1.5 ms, so the scope was widened to cover all CPU work that runs before GL setup.

Changes

  • src/gpu/startup.rs: a std-only Pending<T> that runs work on a named thread. The first get() joins it; a panic becomes an error.
  • run and run_rio start resolve_fonts on hyprburst-fonts, and run also starts LauncherCore::new on hyprburst-core, before the event loop is built. Fonts are joined in GlState::new just before font_metrics and CellRenderer::new. The core is joined in resumed, before the first redraw.
  • If no font is found, the launcher exits with the same message as before. It now happens after the window exists, so the window may flash briefly.
  • Rio's launcher core still runs in the PTY child (NUKE-113).
  • docs/hotpath-findings.md marks finding 2 fixed and gains an "After NUKE-112" section.

Results

Interleaved A/B against main (ed14bcb), 30 cold + 30 warm opens per cell. First-content p95, in ms:

Open Perf main → branch Balanced main → branch
cold native 43.0 → 39.3 47.3 → 42.1
warm native 51.6 → 39.0 52.4 → 46.2
cold Rio 74.9 → 73.4 78.1 → 77.1
warm Rio 80.5 → 82.9 86.4 → 84.3
  • Native is faster in every cell. Rio changes are within noise.
  • With an empty font cache, native content arrives at about 84 ms instead of about 115 ms (performance).
  • The ≤ 10% balanced-vs-performance target (NUKE-115) is not settled. For native it swings by about 8 points between sessions of the same build, and each session misses it in one cell. The doc explains why.

Validation

  • cargo fmt --check.
  • Clippy with -D warnings, default features and --all-features.
  • cargo test --all-targets with default, hotpath and hotpath-alloc features: 327 / 328 / 328 passed, 4 new Pending tests.
  • Hotpath still attributes resolve_fonts, LauncherCore::new and discover_apps on the worker threads.
  • Manual: native and Rio opened live; typing, selection, launch and Esc behave as before. --measure exits normally.

Every open built the fonts and, for the native frontend, the launcher
core (app discovery, history, scores) on the main thread before
creating the event loop, window and GL context, although neither is
needed until the cell renderer and the first paint.

Both now run on worker threads (`hyprburst-fonts`, `hyprburst-core`)
through a small std-only `Pending<T>`, joined in `GlState::new` just
before the renderer is built and in `resumed` before the first paint.
A missing font still exits with the same message, now after the window
exists.

Interleaved A/B against main (n=30 per cell): native first-content p95
drops 3.7-12.6 ms in performance and 5.2-6.2 ms in balanced; Rio is
within noise. With an empty font cache the fontconfig lookup now
overlaps GL setup (native ~115 -> ~84 ms). docs/hotpath-findings.md
records the results, including why the balanced-vs-performance ratio
(NUKE-115) is still unsettled.
@piny4man
piny4man merged commit dca12a7 into main Oct 17, 2026
1 check passed
@piny4man
piny4man deleted the perf/overlap-startup branch November 11, 2026 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant